#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main()
{
    int a = 9;
    int b = 14;
    int c;
    int temp, n;
    while (b % a != 0)
    {
        b = 0;
        n = 0;
        a += 1;
        c = a;
        while (c > 0)
        {
            temp = c % 10;
            b += temp * pow(16, n);
            n += 1;
            c = c / 10;
        }
    }
    cout << a << endl;
    cout << b << endl;
}